@(afangar: List[models.general.vNemandiAfangarOnn], tilkynningar: List[models.domain.Announcements], top5tilkynningar: List[models.domain.Announcements],
  students : List[models.domain.Students], projects : List[models.domain.Project], allProjects: List[models.domain.Project],
  averageAndStuff: List[models.domain.AverageProjects], afangiID : Integer, baekur: List[models.domain.Baekur])
@main(title = "Áfangarnir mínir") {
    <script src="/public/javascripts/amcharts.js" type="text/javascript"></script>

    <div class="container conLower">
        <div class ="row">
            <div class ="span12">
                <div class ="tabbable">
                    <ul class="nav nav-tabs">
                        @for((afangi, i) <- afangar.zipWithIndex) {
                            @if(afangiID != 0){
                                @if(afangi.getAfangi_id == afangiID){
                                    <li class ="active dashStaerri"> <a href ="#tab@{afangi.getAfangi_id }" data-toggle="tab"> @{afangi.getNamsgrein_afanganr}</a> </li>
                                }else {
                                    <li> <a href ="#tab@{afangi.getAfangi_id}" class = "dashStaerri" data-toggle="tab" > @{afangi.getNamsgrein_afanganr}</a> </li>
                                }

                            }else{
                                @if(i == 0) {
                                    <li class ="active dashStaerri"> <a href ="#tab@{afangi.getAfangi_id }" data-toggle="tab"> @{afangi.getNamsgrein_afanganr}</a> </li>
                                } else {
                                    <li> <a href ="#tab@{afangi.getAfangi_id}" class = "dashStaerri" data-toggle="tab" > @{afangi.getNamsgrein_afanganr}</a> </li>
                                }
                            }
                        }
                    </ul>
                    <div class="tab-content">
                        @for((afangi,j) <- afangar.zipWithIndex){
                            @if(j == 0){
                                <div class="tab-pane active" id="tab@{afangi.getAfangi_id}">
                            }else{
                                <div class="tab-pane" id="tab@{afangi.getAfangi_id}">
                            }
                                    <div class ="tabbable tabs-right">
                                        <ul class="nav nav-tabs">
                                        <li class =" active dashStaerri"> <a href ="#tab1@{afangi.getAfangi_id}" data-toggle="tab"> Upphafssíða </a> </li>
                                        <li> <a href ="#tab2@{afangi.getAfangi_id}"  class = "dashStaerri" data-toggle="tab"> Bókalisti </a> </li>
                                        <li> <a href ="#tab3@{afangi.getAfangi_id}"  class = "dashStaerri" data-toggle="tab"> Tilkynningar </a> </li>
                                        <li> <a href ="#tab4@{afangi.getAfangi_id}"  class = "dashStaerri" data-toggle="tab"> Einkunnir </a> </li>
                                        <li> <a href ="#tab5@{afangi.getAfangi_id}"  class = "dashStaerri" data-toggle="tab"> Nemendalisti </a> </li>
                                        <li> <a href ="#tab6@{afangi.getAfangi_id}"  class = "dashStaerri" data-toggle="tab"> Verkefni </a> </li>
                                        <li> <a href ="#tab7@{afangi.getAfangi_id}"  class = "dashStaerri" data-toggle="tab" > Próf </a> </li>
                                        </ul>
                                        <div class="tab-content">
                                            <!--Upphafssíða -->
                                            <div class="tab-pane active" id="tab1@{afangi.getAfangi_id}" >
                                                <div class="row">
                                                    <div class="span4">
                                                        <div>
                                                            <ul class ="nav nav-tabs">
                                                                <li ><a class = "dashStaerri">Næstu skil</a> </li>
                                                            </ul>
                                                        </div>
                                                        <table class = "table table-striped">
                                                        <tr>
                                                            <th>Heiti</th>
                                                            <th>Tegund</th>
                                                            <th>Staða</th>
                                                            <th>Skiladagur</th>
                                                        </tr>
                                                            @for(project <- projects){
                                                                @if(project.getAfangi_id == afangi.getAfangi_id){
                                                                    @if(project.getOpenProjects != null){
                                                                        @for(proj <- project.getOpenProjects){
                                                                            @if(proj.getHandedIn == true){
                                                                                <tr>
                                                                                    <td><a href="@{routes.StudentController.studentOneProject(proj.getVerkefni_id)}" style="color:black;"/>@{proj.getName}</td>
                                                                                    @if(proj.getType=="prof"){
                                                                                        <td>Próf</td>
                                                                                    }
                                                                                    @if(proj.getType=="verkefni"){
                                                                                        <td>Verkefni</td>
                                                                                    }
                                                                                    @if(proj.getHandedIn==true){
                                                                                        <td>Skilað</td>
                                                                                    }
                                                                                    @if(proj.getHandedIn==false){
                                                                                        <td>Óskilað</td>
                                                                                    }
                                                                                    <td id="d@proj.getVerkefni_id()">@{proj.getHandInDate}</td>
                                                                                </tr>
                                                                            }else{
                                                                                <tr id="d@proj.getVerkefni_id()">
                                                                                    <td><a href="@routes.StudentController.studentOneProject(proj.getVerkefni_id)" style="color:black;"/>@{proj.getName}</td>
                                                                                    @if(proj.getType=="prof"){
                                                                                        <td>Próf</td>
                                                                                    }
                                                                                    @if(proj.getType=="verkefni"){
                                                                                        <td>Verkefni</td>
                                                                                    }
                                                                                    @if(proj.getHandedIn==true){
                                                                                        <td>Skilað</td>
                                                                                    }
                                                                                    @if(proj.getHandedIn==false){
                                                                                        <td>Óskilað</td>
                                                                                    }
                                                                                    <td >@{proj.getHandInDate}</td>

                                                                                </tr>

                                                                            }
                                                                        }
                                                                    }

                                                                }

                                                            }
                                                        </table>
                                                    </div>
                                                    <div class="span6">
                                                        <div>
                                                            <ul class ="nav nav-tabs">
                                                                <li ><a class = "dashStaerri">Tilkynningar</a> </li>
                                                            </ul>
                                                        </div>
                                                        <div>
                                                            @for(top5 <- top5tilkynningar){
                                                                @if(top5.getAfangi_id_Int == afangi.getAfangi_id){
                                                                    @if(top5.getTilkynningar != null){
                                                                        @for(top5til <- top5.getTilkynningar){
                                                                            <div class="well">
                                                                                <p style="font-size:15px; font-weight: bold;"> @{top5til.getDagur_stofnad} &nbsp &nbsp @{top5til.getFyrirsogn}</p>
                                                                                <p>@{top5til.getTexti}</p>
                                                                            </div>
                                                                        }
                                                                   }
                                                                }
                                                            }
                                                       </div>
                                                    </div>
                                                </div>
                                             </div>
                                            <!--Bækur -->
                                            <div class="tab-pane" id="tab2@{afangi.getAfangi_id}">
                                                <h3>Bókalisti fyrir @{afangi.getNamsgrein_afanganr}</h3>
                                                @for(bok <- baekur){
                                                    @if(bok.getAfangi_id == afangi.getAfangi_id){
                                                        @if(bok.getHeitiHofundur == null){
                                                            <p>Það eru engar bækur skráðar fyrir þennan áfanga</p>
                                                        }else{
                                                            <table class="table table-striped">
                                                                <thead>
                                                                    <tr>
                                                                        <th>Heiti</th>
                                                                        <th> Höfundur</th>
                                                                        <th> Útgáfa </th>
                                                                        <th> Útgefandi </th>
                                                                    <tr>
                                                                </thead>
                                                                <tbody>
                                                                    @for(bokHeiti <- bok.getHeitiHofundur){
                                                                        <tr>
                                                                            <td>@{bokHeiti.getHeiti}</td>
                                                                            <td>@{bokHeiti.getHofundur}</td>
                                                                            <td>@{bokHeiti.getUtgafa}</td>
                                                                            <td>@{bokHeiti.getUtgefandi}</td>
                                                                        </tr>
                                                                    }
                                                                </tbody>
                                                            </table>
                                                        }
                                                    }
                                                }
                                            </div>
                                            <!--Tilkynningar -->
                                            <div class="tab-pane" id="tab3@{afangi.getAfangi_id}">
                                                <div class="row">
                                                    <div class="span10">
                                                        <div class="tabbable">
                                                            <ul class ="nav nav-tabs">
                                                                <li ><a class = "dashStaerri">Tilkynningar</a> </li>
                                                            </ul>
                                                        </div>
                                                    <div>
                                                        @for(tilkynning <- tilkynningar){
                                                            @if(tilkynning.getAfangi_id_Int == afangi.getAfangi_id){
                                                                @if(tilkynning.getTilkynningar != null){
                                                                    @for(til <- tilkynning.getTilkynningar){
                                                                        <div class="well">
                                                                        <p style="font-size:15px; font-weight: bold;"> @{til.getDagur_stofnad} &nbsp &nbsp @{til.getFyrirsogn}</p>
                                                                        <p>@{til.getTexti}</p>
                                                                        </div>
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <!--Einkunnir -->
                                            <div class="tab-pane" id="tab4@{afangi.getAfangi_id}">
                                                <div class="row">
                                                <div class="span10">
                                                    <table class = "table table-striped">
                                                        <tr class= "table_smallerFont">
                                                            <th>Nafn</th>
                                                            <th>Einkunn</th>
                                                            <th>Vægi</th>
                                                        </tr>
                                                            @for(all <- allProjects) {
                                                                @if(all.getAfangi_id == afangi.getAfangi_id){
                                                                <tr class="table_smallerFont">
                                                                <td>@{all.getName}</td>
                                                                @if(all.getGrade < 20){
                                                                   <td>@{all.getGrade}</td>
                                                                 }else{
                                                                    <td>&nbsp;</td>
                                                                }
                                                                <td>@{all.getWeight}% </td>
                                                                </tr>
                                                               }
                                                            }
                                                        <tr class="table_smallerFont">
                                                            <td> &nbsp;</td>
                                                            <td> &nbsp;</td>
                                                            <td> &nbsp;</td>
                                                        </tr>
                                                        @for(avg <- averageAndStuff){
                                                            @if(avg.getAfangi_id == afangi.getAfangi_id){
                                                                <tr class="table_smallerFont">
                                                                    <td style="font-weight:bold;">Meðaltal</td>
                                                                    <td>@{avg.getAverage}</td>
                                                                    <td> &nbsp;</td>
                                                                </tr>
                                                                <tr class="table_smallerFont">
                                                                    <td style="font-weight:bold;">Vegið meðaltal</td>
                                                                    <td> @{avg.getWeightedAverage} af @{avg.getOverAllWeight}%</td>
                                                                    <td> &nbsp; </td>
                                                                </tr>
                                                                <tr class="table_smallerFont">
                                                                    <td style="font-weight:bold;">Áunnin einkunn</td>
                                                                    <td>@{avg.getEarnedGrade} af @{avg.getEarnedGradeOverAllWeight}</td>
                                                                    <td>&nbsp;</td>
                                                                </tr>
                                                            }
                                                        }
                                                    </table>
                                                </div>
                                                </div>
                                                <div class="row">
                                                    <p> &nbsp;</p>
                                                </div>
                                            </div>
                                            <!--Nemendalisti -->
                                            <div class="tab-pane" id="tab5@{afangi.getAfangi_id}">
                                                <div class="row">
                                                    <div class ="span2">
                                                    </div>
                                                    <div class="span8">
                                                        <table class="table table-striped">
                                                            <tr>
                                                                <th>Nafn</th>
                                                                <th>Kennitala</th>
                                                                <th>Hópur</th>
                                                            </tr>
                                                            @for(student <- students){
                                                                @if(student.getAfangi_id == afangi.getAfangi_id){

                                                                   @for(s <- student.getStudents){
                                                                     <tr>
                                                                       <td>@{s.getName}</td>
                                                                       <td>@{s.getKennitala}</td>
                                                                       <td>@{s.getHopur}</td>
                                                                    </tr>
                                                                   }
                                                                }

                                                            }

                                                        </table>
                                                    </div>
                                                </div>
                                            </div>
                                            <!--Verkefni -->
                                            <div class="tab-pane" id="tab6@{afangi.getAfangi_id}">
                                                <div class="row">
                                                    <div class="span10">
                                                        <h3>Öll Verkefni</h3>

                                                        <div class="tabbable">
                                                            <ul class="nav nav-tabs">
                                                                <li class ="active"><a href ="#opid1@{afangi.getAfangi_id}" data-toggle="tab">Opin Verkefni</a> </li>
                                                                <li><a href ="#lokad1@{afangi.getAfangi_id}" data-toggle="tab">Lokuð Verkefni</a> </li>
                                                            </ul>
                                                            <div class = "tab-content">
                                                                <div class = "tab-pane active" id ="opid1@{afangi.getAfangi_id}">
                                                                    <table class="table table-striped" cellpadding="0" cellspacing="0" border="0" class="display">
                                                                        <thead>
                                                                            <tr>
                                                                                <th>Verkefni</th>
                                                                                <th>Lagt fyrir</th>
                                                                                <th>Skilafrestur</th>
                                                                                <th>Skilað/Óskilað</th>
                                                                                <th>Vægi</th>
                                                                                <th>Einkunn</th>
                                                                            </tr>
                                                                        </thead>

                                                                        <tbody>
                                                                            @for(project <- projects){
                                                                                @if(afangi.getAfangi_id == project.getAfangi_id ){
                                                                                    @if(project.getOpenProjects != null){
                                                                                        @for(proj <- project.getOpenProjects){
                                                                                            @if(proj.getType == "verkefni"){
                                                                                            <tr>
                                                                                            <td><a  href="@routes.StudentController.studentOneProject(proj.getVerkefni_id)" style="color:black;"/>@proj.getName</td>
                                                                                            <td>@proj.getbeginDate()</td>
                                                                                            <td>@proj.getHandInDate</td>
                                                                                                @if(proj.getHandedIn==true){
                                                                                                    <td>Skilað</td>
                                                                                                }
                                                                                                @if(proj.getHandedIn==false){
                                                                                                    <td>Óskilað</td>
                                                                                                }
                                                                                            <td>@(proj.getWeight)%</td>
                                                                                                @if(proj.getGrade == 20){
                                                                                                    <td>-</td> }
                                                                                                @if(proj.getGrade < 20) {
                                                                                                    <td>@proj.getGrade</td> }

                                                                                            </tr>
                                                                                            }
                                                                                        }
                                                                                        }
                                                                                    }
                                                                                }
                                                                        </tbody>

                                                                    </table>
                                                                </div>

                                                                <div class="tab-pane" id="lokad1@{afangi.getAfangi_id}">

                                                                    <table class="table table-striped" cellpadding="0" cellspacing="0" border="0" class="display">
                                                                        <thead>
                                                                            <tr>
                                                                                <th>Verkefni</th>
                                                                                <th>Lagt fyrir</th>
                                                                                <th>Skilafrestur</th>
                                                                                <th>Skilað/Óskilað</th>
                                                                                <th>Vægi</th>
                                                                                <th>Einkunn</th>
                                                                            </tr>
                                                                        </thead>

                                                                        <tbody>
                                                                          @for(project <- projects){
                                                                            @if(afangi.getAfangi_id == project.getAfangi_id ){
                                                                                @if(project.getClosedProjects != null){
                                                                                @for(proj <- project.getClosedProjects){
                                                                                    @if(proj.getType == "verkefni"){
                                                                                    <tr>
                                                                                    <td><a  href="@routes.StudentController.studentOneProject(proj.getVerkefni_id)" style="color:black;"/>@proj.getName</td>
                                                                                    <td>@proj.getbeginDate()</td>
                                                                                    <td>@proj.getHandInDate</td>
                                                                                        @if(proj.getHandedIn==true){
                                                                                            <td>Skilað</td>
                                                                                        }
                                                                                        @if(proj.getHandedIn==false){
                                                                                            <td>Óskilað</td>
                                                                                        }
                                                                                    <td>@(proj.getWeight)%</td>
                                                                                        @if(proj.getGrade == 20){
                                                                                            <td>-</td> }
                                                                                        @if(proj.getGrade < 20) {
                                                                                            <td>@project.getGrade</td> }

                                                                                    </tr>
                                                                                }
                                                                               }
                                                                              }
                                                                            }
                                                                          }
                                                                        </tbody>
                                                                    </table>
                                                                </div>
                                                            </div>
                                                        </div>


                                                    </div>
                                                </div>
                                            </div>
                                            <!--Próf -->
                                            <div class="tab-pane" id="tab7@{afangi.getAfangi_id}">
                                            <div class="row">
                                                <div class="span10">
                                                    <h3>Öll Próf</h3>
                                                    <div class="tabbable">
                                                        <ul class="nav nav-tabs">
                                                            <li class ="active"><a href ="#opid2@{afangi.getAfangi_id}" data-toggle="tab">Opin Próf</a> </li>
                                                            <li><a href ="#lokad2@{afangi.getAfangi_id}" data-toggle="tab">Lokuð Próf</a> </li>
                                                        </ul>
                                                        <div class = "tab-content">
                                                            <div class = "tab-pane active" id ="opid2@{afangi.getAfangi_id}">
                                                                <table class="table table-striped" cellpadding="0" cellspacing="0" border="0" class="display">
                                                                    <thead>
                                                                        <tr>
                                                                        <th>Verkefni</th>
                                                                        <th>Lagt fyrir</th>
                                                                        <th>Skilafrestur</th>
                                                                        <th>Skilað/Óskilað</th>
                                                                        <th>Vægi</th>
                                                                        <th>Einkunn</th>
                                                                        </tr>
                                                                    </thead>

                                                                    <tbody>
                                                                        @for(project <- projects){
                                                                            @if(afangi.getAfangi_id == project.getAfangi_id ){
                                                                                @if(project.getOpenProjects != null){
                                                                                    @for(proj <- project.getOpenProjects){
                                                                                        @if(proj.getType == "prof"){
                                                                                            <tr>
                                                                                                <td><a href="../studentOneProject/@proj.getVerkefni_id" style="color:black;"/>@proj.getName</td>
                                                                                                <td>@proj.getbeginDate()</td>
                                                                                                <td>@proj.getHandInDate</td>
                                                                                                @if(proj.getHandedIn==true){
                                                                                                    <td>Skilað</td>
                                                                                                }
                                                                                                @if(proj.getHandedIn==false){
                                                                                                    <td>Óskilað</td>
                                                                                                }
                                                                                                <td>@(proj.getWeight)%</td>
                                                                                                @if(proj.getGrade == 20){
                                                                                                    <td>-</td> }
                                                                                                @if(proj.getGrade < 20) {
                                                                                                    <td>@proj.getGrade</td> }

                                                                                            </tr>
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    </tbody>

                                                                </table>
                                                       </div>

                                                       <div class="tab-pane" id="lokad2@{afangi.getAfangi_id}">

                                                            <table class="table table-striped" cellpadding="0" cellspacing="0" border="0" class="display">
                                                                <thead>
                                                                    <tr>
                                                                    <th>Verkefni</th>
                                                                    <th>Lagt fyrir</th>
                                                                    <th>Skilafrestur</th>
                                                                    <th>Skilað/Óskilað</th>
                                                                    <th>Vægi</th>
                                                                    <th>Einkunn</th>
                                                                    </tr>
                                                                </thead>

                                                            <tbody>
                                                                    @for(project <- projects){
                                                                        @if(afangi.getAfangi_id == project.getAfangi_id ){
                                                                            @if(project.getClosedProjects != null){
                                                                                @for(proj <- project.getClosedProjects){
                                                                                    @if(proj.getType == "prof"){
                                                                                        <tr>
                                                                                            <td><a href="studentOneProject/@proj.getVerkefni_id" style="color:black;"/>@proj.getName</td>
                                                                                            <td>@proj.getbeginDate()</td>
                                                                                            <td>@proj.getHandInDate</td>
                                                                                            @if(proj.getHandedIn==true){
                                                                                                <td>Skilað</td>
                                                                                            }
                                                                                            @if(proj.getHandedIn==false){
                                                                                                <td>Óskilað</td>
                                                                                            }
                                                                                            <td>@(proj.getWeight)%</td>
                                                                                            @if(proj.getGrade == 20){
                                                                                                <td>-</td> }
                                                                                            @if(proj.getGrade < 20) {
                                                                                                <td>@project.getGrade</td> }

                                                                                        </tr>
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                </tbody>
                                                            </table>
                                                            </div>
                                                        </div>
                                                </div>
                                                </div>
                                            </div>
                                            </div>
                                        </div>
                                    </div>
                        </div>
                            }
                    </div>
                </div>
            </div>
        </div>
    </div>
}